package com.projectsquirrel;



import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class displayStories extends Activity  {
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    setContentView(R.layout.displaystories);
	    TextView obsText = (TextView) findViewById(R.id.obsText);
	    TextView title = (TextView) findViewById(R.id.textView1);
	    Intent sender=getIntent();
	    final String FileName = sender.getExtras().getString("FileName");
	    final StringBuffer buf = new StringBuffer();
	    title.setText(FileName.substring(0, 10));
	    try{
	    	InputStream in = openFileInput(FileName);
	    	if(in!=null) {
	    		InputStreamReader tmp = new InputStreamReader(in);
	    		BufferedReader reader= new BufferedReader(tmp);
	    		String str;
	    		
	    		while((str= reader.readLine()) != null) {
	    			buf.append(str+"\n");
	    		}
	    		in.close();
	    		obsText.setText(buf.toString());
	    	}
	    }
	    catch(java.io.FileNotFoundException e) {
	    	Toast.makeText(this, "Exception: "+ e.toString(), 5000).show();
	    }
	    catch(Throwable t) {
	    	Toast.makeText(this, "Exception: "+ t.toString(), 5000).show();
	    }
	    
	}
	
}
